#include "mainwindow.h"

#include <QApplication>
#include<QFile>
#include<QLatin1String>
#include"global.h"

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    QFile qss(":/style/stylesheet.qss");

    QString app_path=QCoreApplication::applicationDirPath();
    QString fileName= "config.ini";
    QString config_path=QDir::toNativeSeparators(app_path+QDir::separator()+fileName);
    QSettings settings(config_path,QSettings::IniFormat);
    QString gate_host=settings.value("GateServer/host").toString();
    QString gate_post=settings.value("GateServer/port").toString();
    gate_url_prefix="http://"+gate_host+":"+gate_post;

    if(qss.open(QFile::ReadOnly)){
        QString style=QLatin1String(qss.readAll());
        a.setStyleSheet(style);
        qss.close();
    }
    else{
        qDebug("open failed");
    }
    MainWindow w;
    w.show();
    return a.exec();
}
